package com.maixy.rabbitmqdemo.peck;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @ClassName PeckSender
 * @Description TODO
 * @Date 2021/5/8 10:53
 * @Author maixy
 */
@Component
@Slf4j
public class PeckSender {
    @Resource
    private RabbitTemplate rabbitTemplate;

    public void sendMsg() {
        int i = (int)(Math.random() * 10000 + 1);
        rabbitTemplate.convertAndSend(PeckRabbitConfig.PECK_EXCHANGE_1, "peck.abc","用户" + i);
    }
}
